import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import AboutView from '../views/AboutView.vue'
// import ListView from '../views/ListView.vue'
// import OthersView from '../views/OthersView.vue'

const ListView = ()=> import('../views/ListView')
const OthersView = ()=> import('../views/OthersView')


Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/',
  //   redirect:'/home'
  // },
  // 使用重定向css选中效果会没有
  {
    path: '/',
    component: HomeView,
    children:[
      {
        // path不写'/'
        path:'list',
        component:ListView
      },
      {
        path:'others/:msg',
        component:OthersView
      }
    ]
  },
  {
    path:'/about',
    component: AboutView
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
